package sy.aop;

import spring.annotation.*;

@Component
@Aspect
public class LoggerAspect {

    @Before("execution(public int sy.aop.Division.*(..))")
    public void before(){
        System.out.println("计算开始");
    }

    @AfterReturning("execution(public int sy.aop.Division.*(..))")
    public void afterReturning(int result){
        System.out.println("计算结果："+result);
    }

    @AfterThrowing("execution(public int sy.aop.Division.*(..))")
    public void afterThrowing(){
        System.out.println("除数不能为0！");
    }

    @After("execution(public int sy.aop.Division.*(..))")
    public void after(){
        System.out.println("计算结束");
    }

}
